# -*- coding: utf-8 -*-..,
##############################################################################
#
#    OpenERP, Open Source Management Solution
#    Copyright (C) 2014 Crea8s (http://www.crea8s.com) All Rights Reserved.
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU Affero General Public License as
#    published by the Free Software Foundation, either version 3 of the
#    License, or (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU Affero General Public License for more details.
#
#    You should have received a copy of the GNU Affero General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#  
##############################################################################


from openerp.osv import fields, osv


# Inherit of picking to add the link to the SO
# phongnd 20141208: insert prefix crea8s_!!!
# refer: https://bugs.launchpad.net/openobject-addons/+bug/1169998


class stock_picking_in(osv.osv):
#     _name = 'stock.picking'
    _inherit = 'stock.picking.in' 
#     _table="stock_picking"
    _columns = {
        'crea8s_sale_id': fields.many2one('sale.order', 'Sale Order',
            ondelete='set null', select=True),
        'crea8s_sale_text': fields.char('Sales  Order', size=50),
    }
    
    _defaults = {
        'crea8s_sale_id': False,
    }
 
    # def _get_partner_to_invoice(self, cr, uid, picking, context=None):
        # """ desc...
        # """
		# return True
 
stock_picking_in()

class stock_picking(osv.osv):
    _inherit = 'stock.picking' 
    _columns = {
        'crea8s_sale_id': fields.many2one('sale.order', 'Sale Order',
            ondelete='set null', select=True),
        'crea8s_sale_text': fields.char('Sales  Order', size=50),
    }
    
stock_picking()


